import Cookies from 'js-cookie'

const TokenKey = 'token';
const loginDataKey = 'login_data';

export function getToken() {
  return Cookies.get(TokenKey)
}

export function setToken(token) {
  return Cookies.set(TokenKey, token)
}

export function removeToken() {
  return Cookies.remove(TokenKey)
}

export function setLoginData(data) {
  return localStorage.setItem(loginDataKey,JSON.stringify(data));
}

export function getLoginData() {  
  return localStorage.getItem(loginDataKey) != null && localStorage.getItem(loginDataKey) != undefined?JSON.parse(localStorage.getItem(loginDataKey)):null;
}
